<template>
	<view>
		<!-- 导航栏 -->
		<u-navbar class="u-navbar">
			<view class="u-nav-slot" slot="right">
				<u-button size="mini" ripple @click='send' type="success">发表</u-button>
			</view>
		</u-navbar>
		<!-- 内容框 -->
		<u-input v-model="text" type="textarea" fixed height="200" class='textarea' placeholder='说点什么吧……'
			placeholder-style='fontSize:16px' />
		<!-- 图片 -->
		<u-upload ref="uUpload" :auto-upload="false" :action="action" :max-size="5 * 1024 * 1024" max-count="4"
			width='300' height='300' />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				text: '',
				filesArr: [],
				action: 'http://192.168.2.24:7788/oss/files'
			}
		},
		methods: {
			send() {
				// 上传图片
				this.$refs.uUpload.upload();
				this.filesArr = this.$refs.uUpload.lists
				let moments = this.$store.state.moments
				console.log(moments)
				moments.unshift({
					time: '2022-08-05 16:46:26',
					message: this.text,
					like: 0,
					nickname: this.vuex_user.nickname
				})
				console.log(moments)
			}
		}
	}
</script>

<style>
	.u-nav-slot {
		display: flex;
		padding-right: 40rpx;
	}

	.textarea {
		margin: 20rpx;
	}
</style>
